package org.vy.dal.dao.vidhyarthi;

import java.util.List;

import org.vy.dal.QueryManager;
import org.vy.dal.dao.VyVidhyarthiDO;

public class SearchVidhyarthiDAO {

	private static final String FIND_BY_PARAM = "SELECT * FROM <TABLE> WHERE 1 = 1 ";

	@SuppressWarnings("unchecked")
	public static List<VyVidhyarthiDO> findByParam(VyVidhyarthiDO dto)
			throws Exception {

		StringBuilder sb = new StringBuilder(FIND_BY_PARAM);
		if (dto.getVyId() != null) {
			sb.append(" AND VY_ID LIKE '%" + dto.getVyId() + "%' ");
		}
		if (dto.getVidhyalayaName() != null) {
			sb.append(" AND VIDHALAYA_NAME LIKE '%" + dto.getVidhyalayaName()
					+ "%' ");
		}
		if (dto.getBatchNo() != null) {
			sb.append(" AND BATCH_NO '%" + dto.getBatchNo() + "%' ");

		}
		if (dto.getBatchFrom() != null) {
			sb.append(" AND BATCH_FROM '%" + dto.getBatchFrom() + "%' ");
		}
		if (dto.getBatchTo() != null) {
			sb.append(" AND BATCH_TO '%" + dto.getBatchTo() + "%' ");
		}
		if (dto.getRankScore() != null) {
			sb.append(" AND RANK_SCORED LIKE '%" + dto.getRankScore() + "%' ");

		}
		return (List<VyVidhyarthiDO>) QueryManager.executeListQuery(dto, sb
				.toString());
	}
}
